﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web.ASPxGridView;
using DevExpress.Data;

public partial class Top_Manager_Salesbybranch : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Session["current"] = "Sales by Branch";//current page
        if (Session["user"] != null)//check user
        {
            string user = Session["user"].ToString();
            if (user == "viewer")
            {
                Response.Redirect("index.aspx");
            }

        }
        else
        {
            Response.Redirect("index.aspx");
        }
        if (!IsPostBack)
        {
            Panel1.Visible =false;
            Panel2.Visible = false;
            
        }
        
       
    }
    protected void ASPxComboBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
       string branch=ASPxComboBox1.SelectedItem.ToString();
       if (branch =="Kandy")
       {
           Panel1.Visible = true;
           Panel2.Visible = false;
           ASPxSummaryItem totalSummary = new ASPxSummaryItem();
           totalSummary.FieldName = "Total_Price";
           totalSummary.ShowInColumn = "Total_Price";
           totalSummary.SummaryType = SummaryItemType.Sum;
           totalSummary.DisplayFormat = "Total Rs.{0}";
           ASPxGridView1.TotalSummary.Add(totalSummary);
       }
       else
       {
           Panel2.Visible = true;
           Panel1.Visible = false;
           ASPxSummaryItem totalSummary = new ASPxSummaryItem();
           totalSummary.FieldName = "Total_Price";
           totalSummary.ShowInColumn = "Total_Price";
           totalSummary.SummaryType = SummaryItemType.Sum;
           totalSummary.DisplayFormat = "Total Rs.{0}";
           ASPxGridView2.TotalSummary.Add(totalSummary);
       }
       
    }
}